﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>软件工程在线测试</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
	html {
		margin: 0 auto;
	}
	
	body {
		margin: 0 auto;
		margin-bottom: 10px;
		/* border:1px solid blue; */
		width: 900px;
	}
	
	#logo {
		background: url(frontPage/img/exercise_logo.png) top center no-repeat;
		height: 121px;
	}
	</style>
	<script type="text/javascript" language="javascript">
	function scoretest(form){
		   var q=document.getElementsByTagName("p");
		   var h=document.getElementsByTagName("h4");
		//   alert(q.item(0).nextSibling.tagName);
		   for(var i=0;i<q.length;i++){
				var img1=q.item(i).lastChild.previousSibling.previousSibling;
				var img2=q.item(i).lastChild;
				var o=q.item(i).nextSibling;
				var que=o.childNodes;
				var ans=q.item(i).nextSibling.lastChild.previousSibling;
				for(var j=0;j<que.length;j++){
					if(que.item(j).tagName=="INPUT"){
						if(que.item(j).checked&&que.item(j).value==ans.innerHTML.toString()){
							img1.style.display="inline";
							img2.style.display="none";
							break;
						}else {
							img2.style.display="inline";
						}
					}
				}
			
				ans.style.display="inline";
				h.item(i).style.display="inline";
				
		   }
		  
	}
	function rein(){
		history.go(0);
	}
	function click() {
		if (event.button==2) {
			alert("想看答案……合适吗？");
		}
	}
	document.onmousedown=click;
	</script>
	

  </head>
  
  <body>
    <div id="logo">
    </div>
    <div id="testpaper">
    	<table border="0" cellpadding="0" cellspacing="0">
        	<tr>
            	<td width="180" background="frontPage/img/left_bg1.jpg" valign="baseline">
            		<h1></h1>
            		<a href="index.jsp" style="padding-left: 80px;">返回首页</a>
            	</td>
                <td width="720">
                	<form action="">
                    	<h3>一、单项选择题（每个题目只有一个正确答案，请选择正确答案）</h3>
                    	<s:iterator var="exam" value="#request.exams_ogn1" status="index">
                    		<p class="q"><s:property value="#index.count"/>.<s:property value="#exam.question"/><img src="frontPage/img/right.png" style="display:none" />
                    		<img src="frontPage/img/wrong.png" style="display:none"/></p><ol>
                            	<input type="radio" name="q<s:property value="#exam.id"/>"  value="A">
                				A．<s:property value="#exam.optionA"/><br/>
                                <input type="radio" name="q<s:property value="#exam.id"/>"  value="B">
                				B．<s:property value="#exam.optionB"/><br/>
                            	<input type="radio" name="q<s:property value="#exam.id"/>"  value="C">
                				C．<s:property value="#exam.optionC"/><br/>
                			    <input type="radio" name="q<s:property value="#exam.id"/>"  value="D"/>
                				D．<s:property value="#exam.optionD"/><br/><h4 style="display:none; color:#03f;">正确答案：</h4>
                				<span style="display:none; color:#03f; font-weight:bold;" ><s:property value="#exam.answer"/></span>
                            </ol>
                    	</s:iterator>
                    	<h3>二、判断题（请选择对错）</h3>
                    	<s:iterator var="exam" value="#request.exams_ogn2" status="index">
                    		<p class="q"><s:property value="#index.count"/>.<s:property value="#exam.question"/><img src="frontPage/img/right.png" style="display:none" />
                    		<img src="frontPage/img/wrong.png" style="display:none"/></p><ol>
                            	<input type="radio" name="q<s:property value="#exam.id"/>"  value="对">
                				A．对<br/>
                                <input type="radio" name="q<s:property value="#exam.id"/>"  value="错">
                				B．错<br/><h4 style="display:none; color:#03f;">正确答案：</h4>
                				<span style="display:none; color:#03f; font-weight:bold;" ><s:property value="#exam.answer"/></span>
                            </ol>
                    	</s:iterator>
                             <hr />
                          <input type="button" name="submit" value="交卷并评判" onclick=scoretest(this.form)>
              			  <input type="reset" name="reset" value="全部重置" onclick="rein();">
                    </form>
                </td>
            </tr>
        </table>
    </div>
  </body>
</html>
